/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package PIII.Negocio;

/**
 *
 * @author sistemas
 */
public class Vector {
    //region de atributos
    static final int max = 200;
    private int n;
    private PIII.Negocio.Entero[] V =new PIII.Negocio.Entero[max];
    public Vector() {
        this.n = n;
    }
     public void setN(int n) {
        this.n = n;
    }
    public int getN() {
        return n;
    }
    public void insertar_vector(PIII.Negocio.Entero ele){
        V[n]=ele;
        n++;
    }
    public PIII.Negocio.Entero leer_vector(int pos){
        return V[pos];
    }
    private void intercambiar(PIII.Negocio.Entero ele1, PIII.Negocio.Entero ele2){
        PIII.Negocio.Entero aux=new Entero();
        aux.setNum(ele1.getNum());
        ele1.setNum(ele2.getNum());
        ele2.setNum(aux.getNum());
    }
    public void Ordernar(){
        for (int i=0;i<=n-2;i++){
            for (int j=i+1;j<=n-1;j++){
                if(V[i].getNum()>V[j].getNum()){
                    this.intercambiar(V[i],V[j]);
                }
            }
        }
    }
     public void Ivertir(){
        for (int i=0;i<=n/2-1;i++){
            this.intercambiar(V[i],V[(n-1)-i]);
         }
        } 
     public Boolean Buscar(int  ele){
        for (int i=0;i<=n-1;i++){
            if(V[i].getNum()==ele){
              return true;
            }
        }
         return false;
     }
     
}
